package com.ajie.slimming.db;

import android.content.Context;

import com.ajie.slimming.ui.SlimmingApplication;

/**
 * 数据库Api
 * @author Jie Liu
 */
public class DBApi {
	private static DBApi instance;
	private Context mContext;
	private Database mDb = null;

	public static DBApi getInstance() {
		if (instance == null) {
			instance = new DBApi(SlimmingApplication.getBPContext());
		}
		return instance;
	}

	private DBApi(Context context) {
		mContext = context;
		openDatabase();
	}

	private void openDatabase() {
		try {
			if (mDb == null)
				mDb = new Database(mContext);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public Database getDatabase() {
		return mDb;
	}

	
}
